package com.automannn.model;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Document(indexName = "products")
@Data
public class Product {
    
    @Id
    private String id;
    
    @Field(type = FieldType.Text, name = "name",analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String name;
    
    @Field(type = FieldType.Double, name = "price")
    private Double price;
    
    @Field(type = FieldType.Integer, name = "quantity")
    private Integer quantity;
    
    @Field(type = FieldType.Keyword, name = "category")
    private String category;

    @Field(type = FieldType.Keyword)
    private String filed01;

    @Field(type = FieldType.Keyword)
    private String filed02;

    @Field(type = FieldType.Keyword)
    private String filed03;

    @Field(type = FieldType.Keyword)
    private String filed04;

    @Field(type = FieldType.Keyword)
    private String filed05;

    @Field(type = FieldType.Keyword)
    private String filed06;

    @Field(type = FieldType.Keyword)
    private String filed07;

    @Field(type = FieldType.Keyword)
    private String filed08;

    @Field(type = FieldType.Keyword)
    private String filed09;

    @Field(type = FieldType.Keyword)
    private String filed10;

    @Field(type = FieldType.Keyword)
    private Double score;
    
    // 构造方法
    public Product() {}
    
    public Product(String name, Double price, Integer quantity, String category) {
        this.name = name;
        this.price = price;
        this.quantity = quantity;
        this.category = category;
    }
}